{% extends 'base.html' %}
{% block page-main %}
    <form class="col-md-5" action="bigcategory_add.html" method="post">
        {% csrf_token %}
        <input type="text" name="id" value="{{ edit_obj.id }}" style="display: none">
        <div class="form-group">
            <label for="bc">分类名称</label>
            <input type="text" class="form-control" id="bc" placeholder="分类名称" name="bc_title"
                   value="{{ edit_obj.title }}">
        </div>
        <div class="form-group">
            <label for="s1">选择子分类</label>
            <select name="sc_num" multiple id="s1">
                {% for categories in edit_obj.categories.all %}
                    <option value="{{ categories.pk }}" selected>{{ categories.subcategory.title }}</option>
                {% endfor %}
                {% for subcategory in subcategories %}
                    <option value="{{ subcategory.pk }}">{{ subcategory.title }}</option>
                {% endfor %}
            </select>
        </div>
        <button type="submit" class="btn btn-default">提交修改</button>
    </form>
{% endblock %}